import request from "../../utils/request.js";


export default{
  login(message) {
    console.log("message="+message)
    return request({
      url: `/admin/login`,
      method: 'post',
      data:message
    })
  },

  // getPostList(pageNum){
  //   return request({
  //     url: '/post/list',
  //     method: 'get',
  //     params: {
  //       pageNum: pageNum,
  //       pageSize: 5,
  //     }
  //   })
  // },

  //用户列表搜索
  search(key,rl) {
    let result= request({
      url: `/user/list`,
      method: 'get',
      params: {
        name:key,
        role:rl
      },

    })
    console.log("result=",result);
    return result;
  },
  searchSchool(key,rl) {
    let result= request({
      url: `/school/list`,
      method: 'get',
      params: {
        name:key,
        role:rl
      },
    })
    console.log("result=",result);
    return result;
  },


  //学校列表搜索
  schoolSearch(key) {
    return request({
      url: `/school/search`,
      method: 'get',
      params: {
        name: key
      }
    })
  },
  //课程搜索
  courseSearch(key) {
    return request({
      url: `/course/list`,
      method: 'get',
      params: {
        name: key
      }
    })
  },

  //帖子搜索
  CharMsgSearch(key) {
    return request({
      url: `/char/find`,
      method: 'get',
      params: {
        id: key
      }
    })
  },

  //用户列表
  getList(page_num,rl) {
    return request({
      url: `/user/list`,
      method: 'get',
      params: {
        pageNum:page_num,
        pageSize:10,
        role:rl
      }
    })
  },
  getInfoById() {
    return request({
      url: `/admin/infoById`,
      method: 'get',
    })
  },
  //学校列表
  getSchoolList(page_num) {
    return request({
      url: `/school/list`,
      method: 'get',
      params: {
        pageNum:page_num,
        pageSize:10
      }
    })
  },
  //获取帖子列表
  getCharList(page_num) {
    return request({
      url: `/char/findAll`,
      method: 'get',
      params: {
        pageNum:page_num,
        pageSize:10
      }
    })
  },

  //课程列表
  getCourseList(page_num) {
    return request({
      url: `/course/list`,
      method: 'get',
      params: {
        pageNum:page_num,
        pageSize:10
      }
    })
  },


  getAdminInfo(token){
    return request({
      url: `/admin/info`,
      method: 'get',
      header: token
    })
  },
// // 添加文章接口
//   export const addArticle = query => {
//     return request({
//       url: baseUrl+'xxx',//接口地址
//       method: 'get',
//       params: query
//     });
//   };


}